<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\BaseRequest;

class LoginRequest extends BaseRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules(): array
    {
        return [
            'username' => [
                'required'
            ],
            'password' => [
                'required'
            ],
            'captcha_code' => [
                'required',
                'captcha_api:'. request('captcha_key') . ',math'
            ]
        ];
    }

    public function messages(): array
    {
        return [
            'username.required' => '请输入登录帐号',
            'password.required' => '请输入密码',
            'captcha_code.required' => '请输入验证码',
            'captcha_api' => '验证码错误'
        ];
    }
}
